package com.decheng.dto;

import java.util.List;

/**
 * @Author 孔德成
 * @Slogan 致敬大师，致敬未来的你
 * @desc 分页数据传输对象
 */
public class PaginationDTO<T> {
    /**
     * 数据
     */
    private List<T> list;

    /**
     * 当前页
     */
    private Integer currentPage;
    /**
     * 总数据数
     */
    private Long totalCount;

    /**
     * 页面大小
     */
    private Integer pageSize;
    /**
     * 总页数
     */
    private Long totalPage;

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Long getTotalPage() {
        if (totalCount % pageSize != 0) {
            return totalCount / pageSize + 1;
        }
        return totalCount / pageSize;
    }

    public void setTotalPage(Long totalPage) {
        this.totalPage = totalPage;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public Integer getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }

    public Long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Long totalCount) {
        this.totalCount = totalCount;
    }

    @Override
    public String toString() {
        return "PaginationDTO{" +
                "list=" + list +
                ", currentPage=" + currentPage +
                ", totalCount=" + totalCount +
                '}';
    }
}
